| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1 | // -*- C++ -*- | 
|  | 2 | //===-------------------------- iterator ----------------------------------===// | 
|  | 3 | // | 
| Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 5 | // | 
| Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open | 
|  | 7 | // Source Licenses. See LICENSE.TXT for details. | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 8 | // | 
|  | 9 | //===----------------------------------------------------------------------===// | 
|  | 10 |  | 
|  | 11 | #ifndef _LIBCPP_ITERATOR | 
|  | 12 | #define _LIBCPP_ITERATOR | 
|  | 13 |  | 
|  | 14 | /* | 
|  | 15 | iterator synopsis | 
|  | 16 |  | 
|  | 17 | namespace std | 
|  | 18 | { | 
|  | 19 |  | 
|  | 20 | template<class Iterator> | 
|  | 21 | struct iterator_traits | 
|  | 22 | { | 
|  | 23 | typedef typename Iterator::difference_type difference_type; | 
|  | 24 | typedef typename Iterator::value_type value_type; | 
|  | 25 | typedef typename Iterator::pointer pointer; | 
|  | 26 | typedef typename Iterator::reference reference; | 
|  | 27 | typedef typename Iterator::iterator_category iterator_category; | 
|  | 28 | }; | 
|  | 29 |  | 
|  | 30 | template<class T> | 
|  | 31 | struct iterator_traits<T*> | 
|  | 32 | { | 
|  | 33 | typedef ptrdiff_t difference_type; | 
|  | 34 | typedef T value_type; | 
|  | 35 | typedef T* pointer; | 
|  | 36 | typedef T& reference; | 
|  | 37 | typedef random_access_iterator_tag iterator_category; | 
|  | 38 | }; | 
|  | 39 |  | 
|  | 40 | template<class T> | 
|  | 41 | struct iterator_traits<const T*> | 
|  | 42 | { | 
|  | 43 | typedef ptrdiff_t difference_type; | 
|  | 44 | typedef T value_type; | 
|  | 45 | typedef const T* pointer; | 
|  | 46 | typedef const T& reference; | 
|  | 47 | typedef random_access_iterator_tag iterator_category; | 
|  | 48 | }; | 
|  | 49 |  | 
|  | 50 | template<class Category, class T, class Distance = ptrdiff_t, | 
|  | 51 | class Pointer = T*, class Reference = T&> | 
|  | 52 | struct iterator | 
|  | 53 | { | 
|  | 54 | typedef T value_type; | 
|  | 55 | typedef Distance difference_type; | 
|  | 56 | typedef Pointer pointer; | 
|  | 57 | typedef Reference reference; | 
|  | 58 | typedef Category iterator_category; | 
|  | 59 | }; | 
|  | 60 |  | 
|  | 61 | struct input_iterator_tag {}; | 
|  | 62 | struct output_iterator_tag {}; | 
|  | 63 | struct forward_iterator_tag : public input_iterator_tag {}; | 
|  | 64 | struct bidirectional_iterator_tag : public forward_iterator_tag {}; | 
|  | 65 | struct random_access_iterator_tag : public bidirectional_iterator_tag {}; | 
|  | 66 |  | 
|  | 67 | // extension: second argument not conforming to C++03 | 
|  | 68 | template <class InputIterator> | 
|  | 69 | void advance(InputIterator& i, | 
|  | 70 | typename iterator_traits<InputIterator>::difference_type n); | 
|  | 71 |  | 
|  | 72 | template <class InputIterator> | 
|  | 73 | typename iterator_traits<InputIterator>::difference_type | 
|  | 74 | distance(InputIterator first, InputIterator last); | 
|  | 75 |  | 
|  | 76 | template <class Iterator> | 
|  | 77 | class reverse_iterator | 
|  | 78 | : public iterator<typename iterator_traits<Iterator>::iterator_category, | 
|  | 79 | typename iterator_traits<Iterator>::value_type, | 
|  | 80 | typename iterator_traits<Iterator>::difference_type, | 
|  | 81 | typename iterator_traits<Iterator>::pointer, | 
|  | 82 | typename iterator_traits<Iterator>::reference> | 
|  | 83 | { | 
|  | 84 | protected: | 
|  | 85 | Iterator current; | 
|  | 86 | public: | 
|  | 87 | typedef Iterator iterator_type; | 
|  | 88 | typedef typename iterator_traits<Iterator>::difference_type difference_type; | 
|  | 89 | typedef typename iterator_traits<Iterator>::reference reference; | 
|  | 90 | typedef typename iterator_traits<Iterator>::pointer pointer; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 91 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 92 | reverse_iterator(); | 
|  | 93 | explicit reverse_iterator(Iterator x); | 
|  | 94 | template <class U> reverse_iterator(const reverse_iterator<U>& u); | 
|  | 95 | Iterator base() const; | 
|  | 96 | reference operator*() const; | 
|  | 97 | pointer operator->() const; | 
|  | 98 | reverse_iterator& operator++(); | 
|  | 99 | reverse_iterator operator++(int); | 
|  | 100 | reverse_iterator& operator--(); | 
|  | 101 | reverse_iterator operator--(int); | 
|  | 102 | reverse_iterator operator+ (difference_type n) const; | 
|  | 103 | reverse_iterator& operator+=(difference_type n); | 
|  | 104 | reverse_iterator operator- (difference_type n) const; | 
|  | 105 | reverse_iterator& operator-=(difference_type n); | 
|  | 106 | reference operator[](difference_type n) const; | 
|  | 107 | }; | 
|  | 108 |  | 
|  | 109 | template <class Iterator1, class Iterator2> | 
|  | 110 | bool | 
|  | 111 | operator==(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); | 
|  | 112 |  | 
|  | 113 | template <class Iterator1, class Iterator2> | 
|  | 114 | bool | 
|  | 115 | operator<(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); | 
|  | 116 |  | 
|  | 117 | template <class Iterator1, class Iterator2> | 
|  | 118 | bool | 
|  | 119 | operator!=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); | 
|  | 120 |  | 
|  | 121 | template <class Iterator1, class Iterator2> | 
|  | 122 | bool | 
|  | 123 | operator>(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); | 
|  | 124 |  | 
|  | 125 | template <class Iterator1, class Iterator2> | 
|  | 126 | bool | 
|  | 127 | operator>=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); | 
|  | 128 |  | 
|  | 129 | template <class Iterator1, class Iterator2> | 
|  | 130 | bool | 
|  | 131 | operator<=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); | 
|  | 132 |  | 
|  | 133 | template <class Iterator1, class Iterator2> | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 134 | auto | 
|  | 135 | operator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y) | 
|  | 136 | -> decltype(__y.base() - __x.base()); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 137 |  | 
|  | 138 | template <class Iterator> | 
|  | 139 | reverse_iterator<Iterator> | 
|  | 140 | operator+(typename reverse_iterator<Iterator>::difference_type n, const reverse_iterator<Iterator>& x); | 
|  | 141 |  | 
| Marshall Clow | ff137e9 | 2014-03-03 01:24:04 | [diff] [blame] | 142 | template <class Iterator> reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14 | 
|  | 143 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 144 | template <class Container> | 
|  | 145 | class back_insert_iterator | 
|  | 146 | { | 
|  | 147 | protected: | 
|  | 148 | Container* container; | 
|  | 149 | public: | 
|  | 150 | typedef Container container_type; | 
|  | 151 | typedef void value_type; | 
|  | 152 | typedef void difference_type; | 
| Eric Fiselier | c848cef | 2016-06-30 04:40:50 | [diff] [blame] | 153 | typedef void reference; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 154 | typedef void pointer; | 
|  | 155 |  | 
|  | 156 | explicit back_insert_iterator(Container& x); | 
| Howard Hinnant | 45f5717 | 2010-09-14 20:26:27 | [diff] [blame] | 157 | back_insert_iterator& operator=(const typename Container::value_type& value); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 158 | back_insert_iterator& operator*(); | 
|  | 159 | back_insert_iterator& operator++(); | 
|  | 160 | back_insert_iterator operator++(int); | 
|  | 161 | }; | 
|  | 162 |  | 
|  | 163 | template <class Container> back_insert_iterator<Container> back_inserter(Container& x); | 
|  | 164 |  | 
|  | 165 | template <class Container> | 
|  | 166 | class front_insert_iterator | 
|  | 167 | { | 
|  | 168 | protected: | 
|  | 169 | Container* container; | 
|  | 170 | public: | 
|  | 171 | typedef Container container_type; | 
|  | 172 | typedef void value_type; | 
|  | 173 | typedef void difference_type; | 
| Eric Fiselier | c848cef | 2016-06-30 04:40:50 | [diff] [blame] | 174 | typedef void reference; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 175 | typedef void pointer; | 
|  | 176 |  | 
|  | 177 | explicit front_insert_iterator(Container& x); | 
| Howard Hinnant | 45f5717 | 2010-09-14 20:26:27 | [diff] [blame] | 178 | front_insert_iterator& operator=(const typename Container::value_type& value); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 179 | front_insert_iterator& operator*(); | 
|  | 180 | front_insert_iterator& operator++(); | 
|  | 181 | front_insert_iterator operator++(int); | 
|  | 182 | }; | 
|  | 183 |  | 
|  | 184 | template <class Container> front_insert_iterator<Container> front_inserter(Container& x); | 
|  | 185 |  | 
|  | 186 | template <class Container> | 
|  | 187 | class insert_iterator | 
|  | 188 | { | 
|  | 189 | protected: | 
|  | 190 | Container* container; | 
|  | 191 | typename Container::iterator iter; | 
|  | 192 | public: | 
|  | 193 | typedef Container container_type; | 
|  | 194 | typedef void value_type; | 
|  | 195 | typedef void difference_type; | 
| Eric Fiselier | c848cef | 2016-06-30 04:40:50 | [diff] [blame] | 196 | typedef void reference; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 197 | typedef void pointer; | 
|  | 198 |  | 
|  | 199 | insert_iterator(Container& x, typename Container::iterator i); | 
| Howard Hinnant | 45f5717 | 2010-09-14 20:26:27 | [diff] [blame] | 200 | insert_iterator& operator=(const typename Container::value_type& value); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 201 | insert_iterator& operator*(); | 
|  | 202 | insert_iterator& operator++(); | 
|  | 203 | insert_iterator& operator++(int); | 
|  | 204 | }; | 
|  | 205 |  | 
|  | 206 | template <class Container, class Iterator> | 
|  | 207 | insert_iterator<Container> inserter(Container& x, Iterator i); | 
|  | 208 |  | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 209 | template <class Iterator> | 
|  | 210 | class move_iterator { | 
|  | 211 | public: | 
|  | 212 | typedef Iterator iterator_type; | 
|  | 213 | typedef typename iterator_traits<Iterator>::difference_type difference_type; | 
|  | 214 | typedef Iterator pointer; | 
|  | 215 | typedef typename iterator_traits<Iterator>::value_type value_type; | 
|  | 216 | typedef typename iterator_traits<Iterator>::iterator_category iterator_category; | 
|  | 217 | typedef value_type&& reference; | 
|  | 218 |  | 
|  | 219 | move_iterator(); | 
|  | 220 | explicit move_iterator(Iterator i); | 
|  | 221 | template <class U> move_iterator(const move_iterator<U>& u); | 
|  | 222 | template <class U> move_iterator& operator=(const move_iterator<U>& u); | 
|  | 223 | iterator_type base() const; | 
|  | 224 | reference operator*() const; | 
|  | 225 | pointer operator->() const; | 
|  | 226 | move_iterator& operator++(); | 
|  | 227 | move_iterator operator++(int); | 
|  | 228 | move_iterator& operator--(); | 
|  | 229 | move_iterator operator--(int); | 
|  | 230 | move_iterator operator+(difference_type n) const; | 
|  | 231 | move_iterator& operator+=(difference_type n); | 
|  | 232 | move_iterator operator-(difference_type n) const; | 
|  | 233 | move_iterator& operator-=(difference_type n); | 
|  | 234 | unspecified operator[](difference_type n) const; | 
|  | 235 | private: | 
|  | 236 | Iterator current; // exposition only | 
|  | 237 | }; | 
|  | 238 |  | 
|  | 239 | template <class Iterator1, class Iterator2> | 
|  | 240 | bool | 
|  | 241 | operator==(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); | 
|  | 242 |  | 
|  | 243 | template <class Iterator1, class Iterator2> | 
|  | 244 | bool | 
|  | 245 | operator!=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); | 
|  | 246 |  | 
|  | 247 | template <class Iterator1, class Iterator2> | 
|  | 248 | bool | 
|  | 249 | operator<(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); | 
|  | 250 |  | 
|  | 251 | template <class Iterator1, class Iterator2> | 
|  | 252 | bool | 
|  | 253 | operator<=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); | 
|  | 254 |  | 
|  | 255 | template <class Iterator1, class Iterator2> | 
|  | 256 | bool | 
|  | 257 | operator>(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); | 
|  | 258 |  | 
|  | 259 | template <class Iterator1, class Iterator2> | 
|  | 260 | bool | 
|  | 261 | operator>=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); | 
|  | 262 |  | 
|  | 263 | template <class Iterator1, class Iterator2> | 
|  | 264 | auto | 
|  | 265 | operator-(const move_iterator<Iterator1>& x, | 
|  | 266 | const move_iterator<Iterator2>& y) -> decltype(x.base() - y.base()); | 
|  | 267 |  | 
|  | 268 | template <class Iterator> | 
|  | 269 | move_iterator<Iterator> operator+(typename move_iterator<Iterator>::difference_type n, | 
|  | 270 | const move_iterator<Iterator>& x); | 
|  | 271 |  | 
|  | 272 | template <class Iterator> | 
|  | 273 | move_iterator<Iterator> make_move_iterator(const Iterator& i); | 
|  | 274 |  | 
|  | 275 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 276 | template <class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t> | 
|  | 277 | class istream_iterator | 
|  | 278 | : public iterator<input_iterator_tag, T, Distance, const T*, const T&> | 
|  | 279 | { | 
|  | 280 | public: | 
|  | 281 | typedef charT char_type; | 
|  | 282 | typedef traits traits_type; | 
|  | 283 | typedef basic_istream<charT,traits> istream_type; | 
|  | 284 |  | 
| Marshall Clow | e9d0306 | 2015-04-16 21:36:54 | [diff] [blame] | 285 | constexpr istream_iterator(); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 286 | istream_iterator(istream_type& s); | 
|  | 287 | istream_iterator(const istream_iterator& x); | 
|  | 288 | ~istream_iterator(); | 
|  | 289 |  | 
|  | 290 | const T& operator*() const; | 
|  | 291 | const T* operator->() const; | 
|  | 292 | istream_iterator& operator++(); | 
|  | 293 | istream_iterator operator++(int); | 
|  | 294 | }; | 
|  | 295 |  | 
|  | 296 | template <class T, class charT, class traits, class Distance> | 
|  | 297 | bool operator==(const istream_iterator<T,charT,traits,Distance>& x, | 
|  | 298 | const istream_iterator<T,charT,traits,Distance>& y); | 
|  | 299 | template <class T, class charT, class traits, class Distance> | 
|  | 300 | bool operator!=(const istream_iterator<T,charT,traits,Distance>& x, | 
|  | 301 | const istream_iterator<T,charT,traits,Distance>& y); | 
|  | 302 |  | 
|  | 303 | template <class T, class charT = char, class traits = char_traits<charT> > | 
|  | 304 | class ostream_iterator | 
|  | 305 | : public iterator<output_iterator_tag, void, void, void ,void> | 
|  | 306 | { | 
|  | 307 | public: | 
|  | 308 | typedef charT char_type; | 
|  | 309 | typedef traits traits_type; | 
|  | 310 | typedef basic_ostream<charT,traits> ostream_type; | 
|  | 311 |  | 
|  | 312 | ostream_iterator(ostream_type& s); | 
|  | 313 | ostream_iterator(ostream_type& s, const charT* delimiter); | 
|  | 314 | ostream_iterator(const ostream_iterator& x); | 
|  | 315 | ~ostream_iterator(); | 
|  | 316 | ostream_iterator& operator=(const T& value); | 
|  | 317 |  | 
|  | 318 | ostream_iterator& operator*(); | 
|  | 319 | ostream_iterator& operator++(); | 
|  | 320 | ostream_iterator& operator++(int); | 
|  | 321 | }; | 
|  | 322 |  | 
|  | 323 | template<class charT, class traits = char_traits<charT> > | 
|  | 324 | class istreambuf_iterator | 
|  | 325 | : public iterator<input_iterator_tag, charT, | 
|  | 326 | typename traits::off_type, unspecified, | 
|  | 327 | charT> | 
|  | 328 | { | 
|  | 329 | public: | 
|  | 330 | typedef charT char_type; | 
|  | 331 | typedef traits traits_type; | 
|  | 332 | typedef typename traits::int_type int_type; | 
|  | 333 | typedef basic_streambuf<charT,traits> streambuf_type; | 
|  | 334 | typedef basic_istream<charT,traits> istream_type; | 
|  | 335 |  | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 336 | istreambuf_iterator() noexcept; | 
|  | 337 | istreambuf_iterator(istream_type& s) noexcept; | 
|  | 338 | istreambuf_iterator(streambuf_type* s) noexcept; | 
|  | 339 | istreambuf_iterator(a-private-type) noexcept; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 340 |  | 
|  | 341 | charT operator*() const; | 
|  | 342 | pointer operator->() const; | 
|  | 343 | istreambuf_iterator& operator++(); | 
|  | 344 | a-private-type operator++(int); | 
|  | 345 |  | 
|  | 346 | bool equal(const istreambuf_iterator& b) const; | 
|  | 347 | }; | 
|  | 348 |  | 
|  | 349 | template <class charT, class traits> | 
|  | 350 | bool operator==(const istreambuf_iterator<charT,traits>& a, | 
|  | 351 | const istreambuf_iterator<charT,traits>& b); | 
|  | 352 | template <class charT, class traits> | 
|  | 353 | bool operator!=(const istreambuf_iterator<charT,traits>& a, | 
|  | 354 | const istreambuf_iterator<charT,traits>& b); | 
|  | 355 |  | 
|  | 356 | template <class charT, class traits = char_traits<charT> > | 
|  | 357 | class ostreambuf_iterator | 
|  | 358 | : public iterator<output_iterator_tag, void, void, void, void> | 
|  | 359 | { | 
|  | 360 | public: | 
|  | 361 | typedef charT char_type; | 
|  | 362 | typedef traits traits_type; | 
|  | 363 | typedef basic_streambuf<charT,traits> streambuf_type; | 
|  | 364 | typedef basic_ostream<charT,traits> ostream_type; | 
|  | 365 |  | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 366 | ostreambuf_iterator(ostream_type& s) noexcept; | 
|  | 367 | ostreambuf_iterator(streambuf_type* s) noexcept; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 368 | ostreambuf_iterator& operator=(charT c); | 
|  | 369 | ostreambuf_iterator& operator*(); | 
|  | 370 | ostreambuf_iterator& operator++(); | 
|  | 371 | ostreambuf_iterator& operator++(int); | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 372 | bool failed() const noexcept; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 373 | }; | 
|  | 374 |  | 
|  | 375 | template <class C> auto begin(C& c) -> decltype(c.begin()); | 
|  | 376 | template <class C> auto begin(const C& c) -> decltype(c.begin()); | 
|  | 377 | template <class C> auto end(C& c) -> decltype(c.end()); | 
|  | 378 | template <class C> auto end(const C& c) -> decltype(c.end()); | 
|  | 379 | template <class T, size_t N> T* begin(T (&array)[N]); | 
|  | 380 | template <class T, size_t N> T* end(T (&array)[N]); | 
|  | 381 |  | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 382 | template <class C> auto cbegin(const C& c) -> decltype(std::begin(c)); // C++14 | 
|  | 383 | template <class C> auto cend(const C& c) -> decltype(std::end(c)); // C++14 | 
|  | 384 | template <class C> auto rbegin(C& c) -> decltype(c.rbegin()); // C++14 | 
|  | 385 | template <class C> auto rbegin(const C& c) -> decltype(c.rbegin()); // C++14 | 
|  | 386 | template <class C> auto rend(C& c) -> decltype(c.rend()); // C++14 | 
|  | 387 | template <class C> auto rend(const C& c) -> decltype(c.rend()); // C++14 | 
|  | 388 | template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il); // C++14 | 
|  | 389 | template <class E> reverse_iterator<const E*> rend(initializer_list<E> il); // C++14 | 
|  | 390 | template <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]); // C++14 | 
|  | 391 | template <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]); // C++14 | 
|  | 392 | template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14 | 
|  | 393 | template <class C> auto crend(const C& c) -> decltype(std::rend(c)); // C++14 | 
|  | 394 |  | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 395 | // 24.8, container access: | 
|  | 396 | template <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17 | 
|  | 397 | template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17 | 
|  | 398 | template <class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17 | 
|  | 399 | template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // C++17 | 
|  | 400 | template <class E> constexpr bool empty(initializer_list<E> il) noexcept; // C++17 | 
|  | 401 | template <class C> constexpr auto data(C& c) -> decltype(c.data()); // C++17 | 
|  | 402 | template <class C> constexpr auto data(const C& c) -> decltype(c.data()); // C++17 | 
|  | 403 | template <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept; // C++17 | 
|  | 404 | template <class E> constexpr const E* data(initializer_list<E> il) noexcept; // C++17 | 
|  | 405 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 406 | } // std | 
|  | 407 |  | 
|  | 408 | */ | 
|  | 409 |  | 
|  | 410 | #include <__config> | 
| Eric Fiselier | b379228 | 2016-02-20 00:19:45 | [diff] [blame] | 411 | #include <iosfwd> // for forward declarations of vector and string. | 
| Marshall Clow | 02ca8af | 2014-02-27 02:11:50 | [diff] [blame] | 412 | #include <__functional_base> | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 413 | #include <type_traits> | 
|  | 414 | #include <cstddef> | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 415 | #include <initializer_list> | 
| Marshall Clow | dece7fe | 2013-03-18 17:45:34 | [diff] [blame] | 416 | #ifdef __APPLE__ | 
| Howard Hinnant | 537b2fa | 2012-11-14 21:17:15 | [diff] [blame] | 417 | #include <Availability.h> | 
|  | 418 | #endif | 
|  | 419 |  | 
| Eric Fiselier | b953610 | 2014-08-10 23:53:08 | [diff] [blame] | 420 | #include <__debug> | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 421 |  | 
| Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 | [diff] [blame] | 422 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 423 | #pragma GCC system_header | 
| Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 | [diff] [blame] | 424 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 425 |  | 
|  | 426 | _LIBCPP_BEGIN_NAMESPACE_STD | 
|  | 427 |  | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 428 | struct _LIBCPP_TYPE_VIS_ONLY input_iterator_tag {}; | 
|  | 429 | struct _LIBCPP_TYPE_VIS_ONLY output_iterator_tag {}; | 
|  | 430 | struct _LIBCPP_TYPE_VIS_ONLY forward_iterator_tag : public input_iterator_tag {}; | 
|  | 431 | struct _LIBCPP_TYPE_VIS_ONLY bidirectional_iterator_tag : public forward_iterator_tag {}; | 
|  | 432 | struct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {}; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 433 |  | 
|  | 434 | template <class _Tp> | 
|  | 435 | struct __has_iterator_category | 
|  | 436 | { | 
|  | 437 | private: | 
| Howard Hinnant | 9c0df14 | 2012-10-30 19:06:59 | [diff] [blame] | 438 | struct __two {char __lx; char __lxx;}; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 439 | template <class _Up> static __two __test(...); | 
|  | 440 | template <class _Up> static char __test(typename _Up::iterator_category* = 0); | 
|  | 441 | public: | 
|  | 442 | static const bool value = sizeof(__test<_Tp>(0)) == 1; | 
|  | 443 | }; | 
|  | 444 |  | 
| Marshall Clow | a71f956 | 2014-01-03 22:55:49 | [diff] [blame] | 445 | template <class _Iter, bool> struct __iterator_traits_impl {}; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 446 |  | 
|  | 447 | template <class _Iter> | 
| Marshall Clow | a71f956 | 2014-01-03 22:55:49 | [diff] [blame] | 448 | struct __iterator_traits_impl<_Iter, true> | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 449 | { | 
|  | 450 | typedef typename _Iter::difference_type difference_type; | 
|  | 451 | typedef typename _Iter::value_type value_type; | 
|  | 452 | typedef typename _Iter::pointer pointer; | 
|  | 453 | typedef typename _Iter::reference reference; | 
|  | 454 | typedef typename _Iter::iterator_category iterator_category; | 
|  | 455 | }; | 
|  | 456 |  | 
|  | 457 | template <class _Iter, bool> struct __iterator_traits {}; | 
|  | 458 |  | 
|  | 459 | template <class _Iter> | 
|  | 460 | struct __iterator_traits<_Iter, true> | 
| Marshall Clow | a71f956 | 2014-01-03 22:55:49 | [diff] [blame] | 461 | : __iterator_traits_impl | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 462 | < | 
|  | 463 | _Iter, | 
|  | 464 | is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value || | 
|  | 465 | is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value | 
|  | 466 | > | 
|  | 467 | {}; | 
|  | 468 |  | 
|  | 469 | // iterator_traits<Iterator> will only have the nested types if Iterator::iterator_category | 
|  | 470 | // exists. Else iterator_traits<Iterator> will be an empty class. This is a | 
|  | 471 | // conforming extension which allows some programs to compile and behave as | 
|  | 472 | // the client expects instead of failing at compile time. | 
|  | 473 |  | 
|  | 474 | template <class _Iter> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 475 | struct _LIBCPP_TYPE_VIS_ONLY iterator_traits | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 476 | : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {}; | 
|  | 477 |  | 
|  | 478 | template<class _Tp> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 479 | struct _LIBCPP_TYPE_VIS_ONLY iterator_traits<_Tp*> | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 480 | { | 
|  | 481 | typedef ptrdiff_t difference_type; | 
|  | 482 | typedef typename remove_const<_Tp>::type value_type; | 
|  | 483 | typedef _Tp* pointer; | 
|  | 484 | typedef _Tp& reference; | 
|  | 485 | typedef random_access_iterator_tag iterator_category; | 
|  | 486 | }; | 
|  | 487 |  | 
|  | 488 | template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value> | 
|  | 489 | struct __has_iterator_category_convertible_to | 
|  | 490 | : public integral_constant<bool, is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up>::value> | 
|  | 491 | {}; | 
|  | 492 |  | 
|  | 493 | template <class _Tp, class _Up> | 
|  | 494 | struct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {}; | 
|  | 495 |  | 
|  | 496 | template <class _Tp> | 
|  | 497 | struct __is_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {}; | 
|  | 498 |  | 
|  | 499 | template <class _Tp> | 
|  | 500 | struct __is_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {}; | 
|  | 501 |  | 
|  | 502 | template <class _Tp> | 
|  | 503 | struct __is_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {}; | 
|  | 504 |  | 
|  | 505 | template <class _Tp> | 
|  | 506 | struct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {}; | 
|  | 507 |  | 
| Marshall Clow | df9db31 | 2016-01-13 21:54:34 | [diff] [blame] | 508 | template <class _Tp> | 
|  | 509 | struct __is_exactly_input_iterator | 
|  | 510 | : public integral_constant<bool, | 
|  | 511 | __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && | 
|  | 512 | !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; | 
|  | 513 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 514 | template<class _Category, class _Tp, class _Distance = ptrdiff_t, | 
|  | 515 | class _Pointer = _Tp*, class _Reference = _Tp&> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 516 | struct _LIBCPP_TYPE_VIS_ONLY iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 517 | { | 
|  | 518 | typedef _Tp value_type; | 
|  | 519 | typedef _Distance difference_type; | 
|  | 520 | typedef _Pointer pointer; | 
|  | 521 | typedef _Reference reference; | 
|  | 522 | typedef _Category iterator_category; | 
|  | 523 | }; | 
|  | 524 |  | 
|  | 525 | template <class _InputIter> | 
|  | 526 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 527 | void __advance(_InputIter& __i, | 
|  | 528 | typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) | 
|  | 529 | { | 
|  | 530 | for (; __n > 0; --__n) | 
|  | 531 | ++__i; | 
|  | 532 | } | 
|  | 533 |  | 
|  | 534 | template <class _BiDirIter> | 
|  | 535 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 536 | void __advance(_BiDirIter& __i, | 
|  | 537 | typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) | 
|  | 538 | { | 
|  | 539 | if (__n >= 0) | 
|  | 540 | for (; __n > 0; --__n) | 
|  | 541 | ++__i; | 
|  | 542 | else | 
|  | 543 | for (; __n < 0; ++__n) | 
|  | 544 | --__i; | 
|  | 545 | } | 
|  | 546 |  | 
|  | 547 | template <class _RandIter> | 
|  | 548 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 549 | void __advance(_RandIter& __i, | 
|  | 550 | typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) | 
|  | 551 | { | 
|  | 552 | __i += __n; | 
|  | 553 | } | 
|  | 554 |  | 
|  | 555 | template <class _InputIter> | 
|  | 556 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 557 | void advance(_InputIter& __i, | 
|  | 558 | typename iterator_traits<_InputIter>::difference_type __n) | 
|  | 559 | { | 
|  | 560 | __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); | 
|  | 561 | } | 
|  | 562 |  | 
|  | 563 | template <class _InputIter> | 
|  | 564 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 565 | typename iterator_traits<_InputIter>::difference_type | 
|  | 566 | __distance(_InputIter __first, _InputIter __last, input_iterator_tag) | 
|  | 567 | { | 
|  | 568 | typename iterator_traits<_InputIter>::difference_type __r(0); | 
|  | 569 | for (; __first != __last; ++__first) | 
|  | 570 | ++__r; | 
|  | 571 | return __r; | 
|  | 572 | } | 
|  | 573 |  | 
|  | 574 | template <class _RandIter> | 
|  | 575 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 576 | typename iterator_traits<_RandIter>::difference_type | 
|  | 577 | __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) | 
|  | 578 | { | 
|  | 579 | return __last - __first; | 
|  | 580 | } | 
|  | 581 |  | 
|  | 582 | template <class _InputIter> | 
|  | 583 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 584 | typename iterator_traits<_InputIter>::difference_type | 
|  | 585 | distance(_InputIter __first, _InputIter __last) | 
|  | 586 | { | 
|  | 587 | return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); | 
|  | 588 | } | 
|  | 589 |  | 
| Marshall Clow | e9ef988 | 2015-11-07 17:48:49 | [diff] [blame] | 590 | template <class _InputIter> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 591 | inline _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | e9ef988 | 2015-11-07 17:48:49 | [diff] [blame] | 592 | _InputIter | 
|  | 593 | next(_InputIter __x, | 
|  | 594 | typename iterator_traits<_InputIter>::difference_type __n = 1, | 
|  | 595 | typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 596 | { | 
| Howard Hinnant | 0949eed | 2011-06-30 21:18:19 | [diff] [blame] | 597 | _VSTD::advance(__x, __n); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 598 | return __x; | 
|  | 599 | } | 
|  | 600 |  | 
|  | 601 | template <class _BidiretionalIter> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 602 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 603 | _BidiretionalIter | 
|  | 604 | prev(_BidiretionalIter __x, | 
|  | 605 | typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, | 
|  | 606 | typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0) | 
|  | 607 | { | 
| Howard Hinnant | 0949eed | 2011-06-30 21:18:19 | [diff] [blame] | 608 | _VSTD::advance(__x, -__n); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 609 | return __x; | 
|  | 610 | } | 
|  | 611 |  | 
|  | 612 | template <class _Iter> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 613 | class _LIBCPP_TYPE_VIS_ONLY reverse_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 614 | : public iterator<typename iterator_traits<_Iter>::iterator_category, | 
|  | 615 | typename iterator_traits<_Iter>::value_type, | 
|  | 616 | typename iterator_traits<_Iter>::difference_type, | 
|  | 617 | typename iterator_traits<_Iter>::pointer, | 
|  | 618 | typename iterator_traits<_Iter>::reference> | 
|  | 619 | { | 
| Marshall Clow | 668a1d8 | 2014-03-11 22:05:31 | [diff] [blame] | 620 | private: | 
|  | 621 | mutable _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break | 
| Marshall Clow | 5a8e27b | 2014-03-12 01:19:36 | [diff] [blame] | 622 | protected: | 
|  | 623 | _Iter current; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 624 | public: | 
|  | 625 | typedef _Iter iterator_type; | 
|  | 626 | typedef typename iterator_traits<_Iter>::difference_type difference_type; | 
|  | 627 | typedef typename iterator_traits<_Iter>::reference reference; | 
|  | 628 | typedef typename iterator_traits<_Iter>::pointer pointer; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 629 |  | 
| Marshall Clow | 5a8e27b | 2014-03-12 01:19:36 | [diff] [blame] | 630 | _LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {} | 
|  | 631 | _LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 632 | template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u) | 
| Marshall Clow | 5a8e27b | 2014-03-12 01:19:36 | [diff] [blame] | 633 | : __t(__u.base()), current(__u.base()) {} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 634 | _LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;} | 
| Marshall Clow | b1ead68 | 2014-03-11 17:16:17 | [diff] [blame] | 635 | _LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;} | 
| Marshall Clow | 02ca8af | 2014-02-27 02:11:50 | [diff] [blame] | 636 | _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return _VSTD::addressof(operator*());} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 637 | _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;} | 
|  | 638 | _LIBCPP_INLINE_VISIBILITY reverse_iterator operator++(int) | 
|  | 639 | {reverse_iterator __tmp(*this); --current; return __tmp;} | 
|  | 640 | _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator--() {++current; return *this;} | 
|  | 641 | _LIBCPP_INLINE_VISIBILITY reverse_iterator operator--(int) | 
|  | 642 | {reverse_iterator __tmp(*this); ++current; return __tmp;} | 
|  | 643 | _LIBCPP_INLINE_VISIBILITY reverse_iterator operator+ (difference_type __n) const | 
|  | 644 | {return reverse_iterator(current - __n);} | 
|  | 645 | _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator+=(difference_type __n) | 
|  | 646 | {current -= __n; return *this;} | 
|  | 647 | _LIBCPP_INLINE_VISIBILITY reverse_iterator operator- (difference_type __n) const | 
|  | 648 | {return reverse_iterator(current + __n);} | 
|  | 649 | _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n) | 
|  | 650 | {current += __n; return *this;} | 
|  | 651 | _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const | 
| Marshall Clow | ad98e21 | 2015-03-05 16:07:37 | [diff] [blame] | 652 | {return *(*this + __n);} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 653 | }; | 
|  | 654 |  | 
|  | 655 | template <class _Iter1, class _Iter2> | 
|  | 656 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 657 | bool | 
|  | 658 | operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 659 | { | 
|  | 660 | return __x.base() == __y.base(); | 
|  | 661 | } | 
|  | 662 |  | 
|  | 663 | template <class _Iter1, class _Iter2> | 
|  | 664 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 665 | bool | 
|  | 666 | operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 667 | { | 
|  | 668 | return __x.base() > __y.base(); | 
|  | 669 | } | 
|  | 670 |  | 
|  | 671 | template <class _Iter1, class _Iter2> | 
|  | 672 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 673 | bool | 
|  | 674 | operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 675 | { | 
|  | 676 | return __x.base() != __y.base(); | 
|  | 677 | } | 
|  | 678 |  | 
|  | 679 | template <class _Iter1, class _Iter2> | 
|  | 680 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 681 | bool | 
|  | 682 | operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 683 | { | 
|  | 684 | return __x.base() < __y.base(); | 
|  | 685 | } | 
|  | 686 |  | 
|  | 687 | template <class _Iter1, class _Iter2> | 
|  | 688 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 689 | bool | 
|  | 690 | operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 691 | { | 
|  | 692 | return __x.base() <= __y.base(); | 
|  | 693 | } | 
|  | 694 |  | 
|  | 695 | template <class _Iter1, class _Iter2> | 
|  | 696 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 697 | bool | 
|  | 698 | operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 699 | { | 
|  | 700 | return __x.base() >= __y.base(); | 
|  | 701 | } | 
|  | 702 |  | 
| Marshall Clow | 3f01389 | 2016-07-18 13:19:00 | [diff] [blame] | 703 | #ifndef _LIBCPP_CXX03_LANG | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 704 | template <class _Iter1, class _Iter2> | 
|  | 705 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 706 | auto | 
|  | 707 | operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 708 | -> decltype(__y.base() - __x.base()) | 
|  | 709 | { | 
|  | 710 | return __y.base() - __x.base(); | 
|  | 711 | } | 
|  | 712 | #else | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 713 | template <class _Iter1, class _Iter2> | 
|  | 714 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 715 | typename reverse_iterator<_Iter1>::difference_type | 
|  | 716 | operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) | 
|  | 717 | { | 
|  | 718 | return __y.base() - __x.base(); | 
|  | 719 | } | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 720 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 721 |  | 
|  | 722 | template <class _Iter> | 
|  | 723 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 724 | reverse_iterator<_Iter> | 
|  | 725 | operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) | 
|  | 726 | { | 
|  | 727 | return reverse_iterator<_Iter>(__x.base() - __n); | 
|  | 728 | } | 
|  | 729 |  | 
| Marshall Clow | ff137e9 | 2014-03-03 01:24:04 | [diff] [blame] | 730 | #if _LIBCPP_STD_VER > 11 | 
|  | 731 | template <class _Iter> | 
|  | 732 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 733 | reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) | 
|  | 734 | { | 
|  | 735 | return reverse_iterator<_Iter>(__i); | 
|  | 736 | } | 
|  | 737 | #endif | 
|  | 738 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 739 | template <class _Container> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 740 | class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 741 | : public iterator<output_iterator_tag, | 
|  | 742 | void, | 
|  | 743 | void, | 
|  | 744 | void, | 
| Eric Fiselier | c848cef | 2016-06-30 04:40:50 | [diff] [blame] | 745 | void> | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 746 | { | 
|  | 747 | protected: | 
|  | 748 | _Container* container; | 
|  | 749 | public: | 
|  | 750 | typedef _Container container_type; | 
|  | 751 |  | 
| Marshall Clow | 53c0e72 | 2014-03-03 19:20:40 | [diff] [blame] | 752 | _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 753 | _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) | 
|  | 754 | {container->push_back(__value_); return *this;} | 
| Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 | [diff] [blame] | 755 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 756 | _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) | 
|  | 757 | {container->push_back(_VSTD::move(__value_)); return *this;} | 
| Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 | [diff] [blame] | 758 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 759 | _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} | 
|  | 760 | _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} | 
|  | 761 | _LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;} | 
|  | 762 | }; | 
|  | 763 |  | 
|  | 764 | template <class _Container> | 
|  | 765 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 766 | back_insert_iterator<_Container> | 
|  | 767 | back_inserter(_Container& __x) | 
|  | 768 | { | 
|  | 769 | return back_insert_iterator<_Container>(__x); | 
|  | 770 | } | 
|  | 771 |  | 
|  | 772 | template <class _Container> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 773 | class _LIBCPP_TYPE_VIS_ONLY front_insert_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 774 | : public iterator<output_iterator_tag, | 
|  | 775 | void, | 
|  | 776 | void, | 
|  | 777 | void, | 
| Eric Fiselier | c848cef | 2016-06-30 04:40:50 | [diff] [blame] | 778 | void> | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 779 | { | 
|  | 780 | protected: | 
|  | 781 | _Container* container; | 
|  | 782 | public: | 
|  | 783 | typedef _Container container_type; | 
|  | 784 |  | 
| Marshall Clow | 53c0e72 | 2014-03-03 19:20:40 | [diff] [blame] | 785 | _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 786 | _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) | 
|  | 787 | {container->push_front(__value_); return *this;} | 
| Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 | [diff] [blame] | 788 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 789 | _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) | 
|  | 790 | {container->push_front(_VSTD::move(__value_)); return *this;} | 
| Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 | [diff] [blame] | 791 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 792 | _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} | 
|  | 793 | _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} | 
|  | 794 | _LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;} | 
|  | 795 | }; | 
|  | 796 |  | 
|  | 797 | template <class _Container> | 
|  | 798 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 799 | front_insert_iterator<_Container> | 
|  | 800 | front_inserter(_Container& __x) | 
|  | 801 | { | 
|  | 802 | return front_insert_iterator<_Container>(__x); | 
|  | 803 | } | 
|  | 804 |  | 
|  | 805 | template <class _Container> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 806 | class _LIBCPP_TYPE_VIS_ONLY insert_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 807 | : public iterator<output_iterator_tag, | 
|  | 808 | void, | 
|  | 809 | void, | 
|  | 810 | void, | 
| Eric Fiselier | c848cef | 2016-06-30 04:40:50 | [diff] [blame] | 811 | void> | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 812 | { | 
|  | 813 | protected: | 
|  | 814 | _Container* container; | 
|  | 815 | typename _Container::iterator iter; | 
|  | 816 | public: | 
|  | 817 | typedef _Container container_type; | 
|  | 818 |  | 
|  | 819 | _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i) | 
| Marshall Clow | 53c0e72 | 2014-03-03 19:20:40 | [diff] [blame] | 820 | : container(_VSTD::addressof(__x)), iter(__i) {} | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 821 | _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) | 
|  | 822 | {iter = container->insert(iter, __value_); ++iter; return *this;} | 
| Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 | [diff] [blame] | 823 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 824 | _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) | 
|  | 825 | {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} | 
| Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 | [diff] [blame] | 826 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 827 | _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} | 
|  | 828 | _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} | 
|  | 829 | _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;} | 
|  | 830 | }; | 
|  | 831 |  | 
|  | 832 | template <class _Container> | 
|  | 833 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 834 | insert_iterator<_Container> | 
|  | 835 | inserter(_Container& __x, typename _Container::iterator __i) | 
|  | 836 | { | 
|  | 837 | return insert_iterator<_Container>(__x, __i); | 
|  | 838 | } | 
|  | 839 |  | 
|  | 840 | template <class _Tp, class _CharT = char, | 
|  | 841 | class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 842 | class _LIBCPP_TYPE_VIS_ONLY istream_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 843 | : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&> | 
|  | 844 | { | 
|  | 845 | public: | 
|  | 846 | typedef _CharT char_type; | 
|  | 847 | typedef _Traits traits_type; | 
|  | 848 | typedef basic_istream<_CharT,_Traits> istream_type; | 
|  | 849 | private: | 
|  | 850 | istream_type* __in_stream_; | 
|  | 851 | _Tp __value_; | 
|  | 852 | public: | 
| Marshall Clow | e9d0306 | 2015-04-16 21:36:54 | [diff] [blame] | 853 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {} | 
| Marshall Clow | d8fc1ec | 2016-05-17 17:44:40 | [diff] [blame] | 854 | _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(_VSTD::addressof(__s)) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 855 | { | 
|  | 856 | if (!(*__in_stream_ >> __value_)) | 
|  | 857 | __in_stream_ = 0; | 
|  | 858 | } | 
|  | 859 |  | 
|  | 860 | _LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;} | 
| Marshall Clow | d8fc1ec | 2016-05-17 17:44:40 | [diff] [blame] | 861 | _LIBCPP_INLINE_VISIBILITY const _Tp* operator->() const {return _VSTD::addressof((operator*()));} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 862 | _LIBCPP_INLINE_VISIBILITY istream_iterator& operator++() | 
|  | 863 | { | 
|  | 864 | if (!(*__in_stream_ >> __value_)) | 
|  | 865 | __in_stream_ = 0; | 
|  | 866 | return *this; | 
|  | 867 | } | 
|  | 868 | _LIBCPP_INLINE_VISIBILITY istream_iterator operator++(int) | 
|  | 869 | {istream_iterator __t(*this); ++(*this); return __t;} | 
|  | 870 |  | 
|  | 871 | friend _LIBCPP_INLINE_VISIBILITY | 
|  | 872 | bool operator==(const istream_iterator& __x, const istream_iterator& __y) | 
|  | 873 | {return __x.__in_stream_ == __y.__in_stream_;} | 
|  | 874 |  | 
|  | 875 | friend _LIBCPP_INLINE_VISIBILITY | 
|  | 876 | bool operator!=(const istream_iterator& __x, const istream_iterator& __y) | 
|  | 877 | {return !(__x == __y);} | 
|  | 878 | }; | 
|  | 879 |  | 
|  | 880 | template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> > | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 881 | class _LIBCPP_TYPE_VIS_ONLY ostream_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 882 | : public iterator<output_iterator_tag, void, void, void, void> | 
|  | 883 | { | 
|  | 884 | public: | 
|  | 885 | typedef _CharT char_type; | 
|  | 886 | typedef _Traits traits_type; | 
|  | 887 | typedef basic_ostream<_CharT,_Traits> ostream_type; | 
|  | 888 | private: | 
|  | 889 | ostream_type* __out_stream_; | 
|  | 890 | const char_type* __delim_; | 
|  | 891 | public: | 
|  | 892 | _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) | 
| Marshall Clow | d8fc1ec | 2016-05-17 17:44:40 | [diff] [blame] | 893 | : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 894 | _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) | 
| Marshall Clow | d8fc1ec | 2016-05-17 17:44:40 | [diff] [blame] | 895 | : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {} | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 896 | _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 897 | { | 
| Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 | [diff] [blame] | 898 | *__out_stream_ << __value_; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 899 | if (__delim_) | 
|  | 900 | *__out_stream_ << __delim_; | 
|  | 901 | return *this; | 
|  | 902 | } | 
|  | 903 |  | 
|  | 904 | _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator*() {return *this;} | 
|  | 905 | _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++() {return *this;} | 
|  | 906 | _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++(int) {return *this;} | 
|  | 907 | }; | 
|  | 908 |  | 
|  | 909 | template<class _CharT, class _Traits> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 910 | class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 911 | : public iterator<input_iterator_tag, _CharT, | 
|  | 912 | typename _Traits::off_type, _CharT*, | 
|  | 913 | _CharT> | 
|  | 914 | { | 
|  | 915 | public: | 
|  | 916 | typedef _CharT char_type; | 
|  | 917 | typedef _Traits traits_type; | 
|  | 918 | typedef typename _Traits::int_type int_type; | 
|  | 919 | typedef basic_streambuf<_CharT,_Traits> streambuf_type; | 
|  | 920 | typedef basic_istream<_CharT,_Traits> istream_type; | 
|  | 921 | private: | 
| Howard Hinnant | 984f10f | 2012-11-16 22:17:23 | [diff] [blame] | 922 | mutable streambuf_type* __sbuf_; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 923 |  | 
|  | 924 | class __proxy | 
|  | 925 | { | 
|  | 926 | char_type __keep_; | 
|  | 927 | streambuf_type* __sbuf_; | 
|  | 928 | _LIBCPP_INLINE_VISIBILITY __proxy(char_type __c, streambuf_type* __s) | 
|  | 929 | : __keep_(__c), __sbuf_(__s) {} | 
|  | 930 | friend class istreambuf_iterator; | 
|  | 931 | public: | 
|  | 932 | _LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;} | 
|  | 933 | }; | 
|  | 934 |  | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 935 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 984f10f | 2012-11-16 22:17:23 | [diff] [blame] | 936 | bool __test_for_eof() const | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 937 | { | 
|  | 938 | if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) | 
|  | 939 | __sbuf_ = 0; | 
| Howard Hinnant | 984f10f | 2012-11-16 22:17:23 | [diff] [blame] | 940 | return __sbuf_ == 0; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 941 | } | 
|  | 942 | public: | 
| Howard Hinnant | 984f10f | 2012-11-16 22:17:23 | [diff] [blame] | 943 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 944 | _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT | 
| Howard Hinnant | d1a7479 | 2012-12-29 17:45:42 | [diff] [blame] | 945 | : __sbuf_(__s.rdbuf()) {} | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 946 | _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT | 
| Howard Hinnant | d1a7479 | 2012-12-29 17:45:42 | [diff] [blame] | 947 | : __sbuf_(__s) {} | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 948 | _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 949 | : __sbuf_(__p.__sbuf_) {} | 
|  | 950 |  | 
| Howard Hinnant | ec3773c | 2011-12-01 20:21:04 | [diff] [blame] | 951 | _LIBCPP_INLINE_VISIBILITY char_type operator*() const | 
|  | 952 | {return static_cast<char_type>(__sbuf_->sgetc());} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 953 | _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} | 
|  | 954 | _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() | 
|  | 955 | { | 
| Howard Hinnant | 984f10f | 2012-11-16 22:17:23 | [diff] [blame] | 956 | __sbuf_->sbumpc(); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 957 | return *this; | 
|  | 958 | } | 
|  | 959 | _LIBCPP_INLINE_VISIBILITY __proxy operator++(int) | 
|  | 960 | { | 
| Howard Hinnant | 984f10f | 2012-11-16 22:17:23 | [diff] [blame] | 961 | return __proxy(__sbuf_->sbumpc(), __sbuf_); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 962 | } | 
|  | 963 |  | 
|  | 964 | _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const | 
| Howard Hinnant | 984f10f | 2012-11-16 22:17:23 | [diff] [blame] | 965 | {return __test_for_eof() == __b.__test_for_eof();} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 966 | }; | 
|  | 967 |  | 
|  | 968 | template <class _CharT, class _Traits> | 
|  | 969 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 970 | bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a, | 
|  | 971 | const istreambuf_iterator<_CharT,_Traits>& __b) | 
|  | 972 | {return __a.equal(__b);} | 
|  | 973 |  | 
|  | 974 | template <class _CharT, class _Traits> | 
|  | 975 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 976 | bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a, | 
|  | 977 | const istreambuf_iterator<_CharT,_Traits>& __b) | 
|  | 978 | {return !__a.equal(__b);} | 
|  | 979 |  | 
|  | 980 | template <class _CharT, class _Traits> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 981 | class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 982 | : public iterator<output_iterator_tag, void, void, void, void> | 
|  | 983 | { | 
|  | 984 | public: | 
|  | 985 | typedef _CharT char_type; | 
|  | 986 | typedef _Traits traits_type; | 
|  | 987 | typedef basic_streambuf<_CharT,_Traits> streambuf_type; | 
|  | 988 | typedef basic_ostream<_CharT,_Traits> ostream_type; | 
|  | 989 | private: | 
|  | 990 | streambuf_type* __sbuf_; | 
|  | 991 | public: | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 992 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 993 | : __sbuf_(__s.rdbuf()) {} | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 994 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 995 | : __sbuf_(__s) {} | 
|  | 996 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c) | 
|  | 997 | { | 
|  | 998 | if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof())) | 
|  | 999 | __sbuf_ = 0; | 
|  | 1000 | return *this; | 
|  | 1001 | } | 
|  | 1002 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;} | 
|  | 1003 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;} | 
|  | 1004 | _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;} | 
| Howard Hinnant | d06a640 | 2012-07-20 19:36:34 | [diff] [blame] | 1005 | _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} | 
| Howard Hinnant | a585de6 | 2012-09-19 19:14:15 | [diff] [blame] | 1006 |  | 
| Howard Hinnant | 537b2fa | 2012-11-14 21:17:15 | [diff] [blame] | 1007 | #if !defined(__APPLE__) || \ | 
|  | 1008 | (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ | 
|  | 1009 | (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0) | 
|  | 1010 |  | 
| Howard Hinnant | a585de6 | 2012-09-19 19:14:15 | [diff] [blame] | 1011 | template <class _Ch, class _Tr> | 
|  | 1012 | friend | 
|  | 1013 | _LIBCPP_HIDDEN | 
|  | 1014 | ostreambuf_iterator<_Ch, _Tr> | 
|  | 1015 | __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s, | 
|  | 1016 | const _Ch* __ob, const _Ch* __op, const _Ch* __oe, | 
|  | 1017 | ios_base& __iob, _Ch __fl); | 
| Howard Hinnant | 537b2fa | 2012-11-14 21:17:15 | [diff] [blame] | 1018 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1019 | }; | 
|  | 1020 |  | 
|  | 1021 | template <class _Iter> | 
| Howard Hinnant | 0f678bd | 2013-08-12 18:38:34 | [diff] [blame] | 1022 | class _LIBCPP_TYPE_VIS_ONLY move_iterator | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1023 | { | 
|  | 1024 | private: | 
|  | 1025 | _Iter __i; | 
|  | 1026 | public: | 
|  | 1027 | typedef _Iter iterator_type; | 
|  | 1028 | typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; | 
|  | 1029 | typedef typename iterator_traits<iterator_type>::value_type value_type; | 
|  | 1030 | typedef typename iterator_traits<iterator_type>::difference_type difference_type; | 
| Marshall Clow | dca800c | 2016-04-11 03:54:53 | [diff] [blame] | 1031 | typedef iterator_type pointer; | 
| Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 | [diff] [blame] | 1032 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES | 
| Eric Fiselier | df46b78 | 2016-04-22 00:49:12 | [diff] [blame] | 1033 | typedef typename iterator_traits<iterator_type>::reference __reference; | 
|  | 1034 | typedef typename conditional< | 
|  | 1035 | is_reference<__reference>::value, | 
|  | 1036 | typename remove_reference<__reference>::type&&, | 
|  | 1037 | __reference | 
|  | 1038 | >::type reference; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1039 | #else | 
|  | 1040 | typedef typename iterator_traits<iterator_type>::reference reference; | 
|  | 1041 | #endif | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1042 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1043 | _LIBCPP_INLINE_VISIBILITY move_iterator() : __i() {} | 
|  | 1044 | _LIBCPP_INLINE_VISIBILITY explicit move_iterator(_Iter __x) : __i(__x) {} | 
|  | 1045 | template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u) | 
|  | 1046 | : __i(__u.base()) {} | 
|  | 1047 | _LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;} | 
| Douglas Gregor | aab015a | 2011-01-26 00:12:48 | [diff] [blame] | 1048 | _LIBCPP_INLINE_VISIBILITY reference operator*() const { | 
|  | 1049 | return static_cast<reference>(*__i); | 
|  | 1050 | } | 
| Marshall Clow | dca800c | 2016-04-11 03:54:53 | [diff] [blame] | 1051 | _LIBCPP_INLINE_VISIBILITY pointer operator->() const { return __i;} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1052 | _LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;} | 
|  | 1053 | _LIBCPP_INLINE_VISIBILITY move_iterator operator++(int) | 
|  | 1054 | {move_iterator __tmp(*this); ++__i; return __tmp;} | 
|  | 1055 | _LIBCPP_INLINE_VISIBILITY move_iterator& operator--() {--__i; return *this;} | 
|  | 1056 | _LIBCPP_INLINE_VISIBILITY move_iterator operator--(int) | 
|  | 1057 | {move_iterator __tmp(*this); --__i; return __tmp;} | 
|  | 1058 | _LIBCPP_INLINE_VISIBILITY move_iterator operator+ (difference_type __n) const | 
|  | 1059 | {return move_iterator(__i + __n);} | 
|  | 1060 | _LIBCPP_INLINE_VISIBILITY move_iterator& operator+=(difference_type __n) | 
|  | 1061 | {__i += __n; return *this;} | 
|  | 1062 | _LIBCPP_INLINE_VISIBILITY move_iterator operator- (difference_type __n) const | 
|  | 1063 | {return move_iterator(__i - __n);} | 
|  | 1064 | _LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n) | 
|  | 1065 | {__i -= __n; return *this;} | 
|  | 1066 | _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const | 
| Douglas Gregor | aab015a | 2011-01-26 00:12:48 | [diff] [blame] | 1067 | { | 
|  | 1068 | return static_cast<reference>(__i[__n]); | 
|  | 1069 | } | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1070 | }; | 
|  | 1071 |  | 
|  | 1072 | template <class _Iter1, class _Iter2> | 
|  | 1073 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1074 | bool | 
|  | 1075 | operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1076 | { | 
|  | 1077 | return __x.base() == __y.base(); | 
|  | 1078 | } | 
|  | 1079 |  | 
|  | 1080 | template <class _Iter1, class _Iter2> | 
|  | 1081 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1082 | bool | 
|  | 1083 | operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1084 | { | 
|  | 1085 | return __x.base() < __y.base(); | 
|  | 1086 | } | 
|  | 1087 |  | 
|  | 1088 | template <class _Iter1, class _Iter2> | 
|  | 1089 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1090 | bool | 
|  | 1091 | operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1092 | { | 
|  | 1093 | return __x.base() != __y.base(); | 
|  | 1094 | } | 
|  | 1095 |  | 
|  | 1096 | template <class _Iter1, class _Iter2> | 
|  | 1097 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1098 | bool | 
|  | 1099 | operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1100 | { | 
|  | 1101 | return __x.base() > __y.base(); | 
|  | 1102 | } | 
|  | 1103 |  | 
|  | 1104 | template <class _Iter1, class _Iter2> | 
|  | 1105 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1106 | bool | 
|  | 1107 | operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1108 | { | 
|  | 1109 | return __x.base() >= __y.base(); | 
|  | 1110 | } | 
|  | 1111 |  | 
|  | 1112 | template <class _Iter1, class _Iter2> | 
|  | 1113 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1114 | bool | 
|  | 1115 | operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1116 | { | 
|  | 1117 | return __x.base() <= __y.base(); | 
|  | 1118 | } | 
|  | 1119 |  | 
| Marshall Clow | 3f01389 | 2016-07-18 13:19:00 | [diff] [blame] | 1120 | #ifndef _LIBCPP_CXX03_LANG | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1121 | template <class _Iter1, class _Iter2> | 
|  | 1122 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1123 | auto | 
|  | 1124 | operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1125 | -> decltype(__x.base() - __y.base()) | 
|  | 1126 | { | 
|  | 1127 | return __x.base() - __y.base(); | 
|  | 1128 | } | 
|  | 1129 | #else | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1130 | template <class _Iter1, class _Iter2> | 
|  | 1131 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1132 | typename move_iterator<_Iter1>::difference_type | 
|  | 1133 | operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) | 
|  | 1134 | { | 
|  | 1135 | return __x.base() - __y.base(); | 
|  | 1136 | } | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1137 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1138 |  | 
|  | 1139 | template <class _Iter> | 
|  | 1140 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1141 | move_iterator<_Iter> | 
|  | 1142 | operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) | 
|  | 1143 | { | 
|  | 1144 | return move_iterator<_Iter>(__x.base() + __n); | 
|  | 1145 | } | 
|  | 1146 |  | 
|  | 1147 | template <class _Iter> | 
|  | 1148 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1149 | move_iterator<_Iter> | 
| Marshall Clow | af74651 | 2013-08-27 13:03:03 | [diff] [blame] | 1150 | make_move_iterator(_Iter __i) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1151 | { | 
|  | 1152 | return move_iterator<_Iter>(__i); | 
|  | 1153 | } | 
|  | 1154 |  | 
|  | 1155 | // __wrap_iter | 
|  | 1156 |  | 
|  | 1157 | template <class _Iter> class __wrap_iter; | 
|  | 1158 |  | 
|  | 1159 | template <class _Iter1, class _Iter2> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1160 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1161 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1162 | operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1163 |  | 
|  | 1164 | template <class _Iter1, class _Iter2> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1165 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1166 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1167 | operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1168 |  | 
|  | 1169 | template <class _Iter1, class _Iter2> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1170 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1171 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1172 | operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1173 |  | 
|  | 1174 | template <class _Iter1, class _Iter2> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1175 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1176 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1177 | operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1178 |  | 
|  | 1179 | template <class _Iter1, class _Iter2> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1180 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1181 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1182 | operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1183 |  | 
|  | 1184 | template <class _Iter1, class _Iter2> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1185 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1186 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1187 | operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1188 |  | 
| Marshall Clow | 3f01389 | 2016-07-18 13:19:00 | [diff] [blame] | 1189 | #ifndef _LIBCPP_CXX03_LANG | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1190 | template <class _Iter1, class _Iter2> | 
|  | 1191 | _LIBCPP_INLINE_VISIBILITY | 
|  | 1192 | auto | 
|  | 1193 | operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
|  | 1194 | -> decltype(__x.base() - __y.base()); | 
|  | 1195 | #else | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1196 | template <class _Iter1, class _Iter2> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1197 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1198 | typename __wrap_iter<_Iter1>::difference_type | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1199 | operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1200 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1201 |  | 
|  | 1202 | template <class _Iter> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1203 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1204 | __wrap_iter<_Iter> | 
| Howard Hinnant | 2baccd8 | 2011-10-11 21:28:38 | [diff] [blame] | 1205 | operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1206 |  | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1207 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op); | 
|  | 1208 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2); | 
|  | 1209 | template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); | 
|  | 1210 | template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1211 |  | 
|  | 1212 | template <class _Tp> | 
| Howard Hinnant | 33be35e | 2012-09-14 00:39:16 | [diff] [blame] | 1213 | _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1214 | typename enable_if | 
|  | 1215 | < | 
| Howard Hinnant | 1468b66 | 2010-11-19 22:17:28 | [diff] [blame] | 1216 | is_trivially_copy_assignable<_Tp>::value, | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1217 | _Tp* | 
|  | 1218 | >::type | 
|  | 1219 | __unwrap_iter(__wrap_iter<_Tp*>); | 
|  | 1220 |  | 
|  | 1221 | template <class _Iter> | 
|  | 1222 | class __wrap_iter | 
|  | 1223 | { | 
|  | 1224 | public: | 
|  | 1225 | typedef _Iter iterator_type; | 
|  | 1226 | typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; | 
|  | 1227 | typedef typename iterator_traits<iterator_type>::value_type value_type; | 
|  | 1228 | typedef typename iterator_traits<iterator_type>::difference_type difference_type; | 
|  | 1229 | typedef typename iterator_traits<iterator_type>::pointer pointer; | 
|  | 1230 | typedef typename iterator_traits<iterator_type>::reference reference; | 
|  | 1231 | private: | 
|  | 1232 | iterator_type __i; | 
|  | 1233 | public: | 
| Howard Hinnant | 7608b4a | 2011-09-16 19:52:23 | [diff] [blame] | 1234 | _LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT | 
| Marshall Clow | 0f164c9 | 2013-08-07 20:48:48 | [diff] [blame] | 1235 | #if _LIBCPP_STD_VER > 11 | 
|  | 1236 | : __i{} | 
|  | 1237 | #endif | 
| Howard Hinnant | 7608b4a | 2011-09-16 19:52:23 | [diff] [blame] | 1238 | { | 
|  | 1239 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
|  | 1240 | __get_db()->__insert_i(this); | 
|  | 1241 | #endif | 
|  | 1242 | } | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1243 | template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u, | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1244 | typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1245 | : __i(__u.base()) | 
|  | 1246 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1247 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1248 | __get_db()->__iterator_copy(this, &__u); | 
|  | 1249 | #endif | 
|  | 1250 | } | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1251 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1252 | _LIBCPP_INLINE_VISIBILITY | 
|  | 1253 | __wrap_iter(const __wrap_iter& __x) | 
|  | 1254 | : __i(__x.base()) | 
|  | 1255 | { | 
|  | 1256 | __get_db()->__iterator_copy(this, &__x); | 
|  | 1257 | } | 
|  | 1258 | _LIBCPP_INLINE_VISIBILITY | 
|  | 1259 | __wrap_iter& operator=(const __wrap_iter& __x) | 
|  | 1260 | { | 
|  | 1261 | if (this != &__x) | 
|  | 1262 | { | 
|  | 1263 | __get_db()->__iterator_copy(this, &__x); | 
|  | 1264 | __i = __x.__i; | 
|  | 1265 | } | 
|  | 1266 | return *this; | 
|  | 1267 | } | 
|  | 1268 | _LIBCPP_INLINE_VISIBILITY | 
|  | 1269 | ~__wrap_iter() | 
|  | 1270 | { | 
|  | 1271 | __get_db()->__erase_i(this); | 
|  | 1272 | } | 
|  | 1273 | #endif | 
|  | 1274 | _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT | 
|  | 1275 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1276 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1277 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), | 
|  | 1278 | "Attempted to dereference a non-dereferenceable iterator"); | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1279 | #endif | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1280 | return *__i; | 
|  | 1281 | } | 
| Howard Hinnant | 2c39cbe | 2013-06-27 19:35:32 | [diff] [blame] | 1282 | _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT | 
|  | 1283 | { | 
|  | 1284 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
|  | 1285 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), | 
|  | 1286 | "Attempted to dereference a non-dereferenceable iterator"); | 
|  | 1287 | #endif | 
| Marshall Clow | dca800c | 2016-04-11 03:54:53 | [diff] [blame] | 1288 | return (pointer)_VSTD::addressof(*__i); | 
| Howard Hinnant | 2c39cbe | 2013-06-27 19:35:32 | [diff] [blame] | 1289 | } | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1290 | _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT | 
|  | 1291 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1292 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1293 | _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), | 
|  | 1294 | "Attempted to increment non-incrementable iterator"); | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1295 | #endif | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1296 | ++__i; | 
|  | 1297 | return *this; | 
|  | 1298 | } | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1299 | _LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1300 | {__wrap_iter __tmp(*this); ++(*this); return __tmp;} | 
|  | 1301 | _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT | 
|  | 1302 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1303 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1304 | _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), | 
|  | 1305 | "Attempted to decrement non-decrementable iterator"); | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1306 | #endif | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1307 | --__i; | 
|  | 1308 | return *this; | 
|  | 1309 | } | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1310 | _LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1311 | {__wrap_iter __tmp(*this); --(*this); return __tmp;} | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1312 | _LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1313 | {__wrap_iter __w(*this); __w += __n; return __w;} | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1314 | _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1315 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1316 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1317 | _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n), | 
|  | 1318 | "Attempted to add/subtract iterator outside of valid range"); | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1319 | #endif | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1320 | __i += __n; | 
|  | 1321 | return *this; | 
|  | 1322 | } | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1323 | _LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1324 | {return *this + (-__n);} | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1325 | _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1326 | {*this += -__n; return *this;} | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1327 | _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1328 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1329 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1330 | _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n), | 
|  | 1331 | "Attempted to subscript iterator outside of valid range"); | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1332 | #endif | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1333 | return __i[__n]; | 
|  | 1334 | } | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1335 |  | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1336 | _LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;} | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1337 |  | 
|  | 1338 | private: | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1339 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1340 | _LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x) | 
|  | 1341 | { | 
|  | 1342 | __get_db()->__insert_ic(this, __p); | 
|  | 1343 | } | 
| Howard Hinnant | 499cea1 | 2013-08-23 17:37:05 | [diff] [blame] | 1344 | #else | 
|  | 1345 | _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1346 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1347 |  | 
|  | 1348 | template <class _Up> friend class __wrap_iter; | 
|  | 1349 | template <class _CharT, class _Traits, class _Alloc> friend class basic_string; | 
| Marshall Clow | 59f573f | 2015-02-18 19:28:35 | [diff] [blame] | 1350 | template <class _Tp, class _Alloc> friend class _LIBCPP_TYPE_VIS_ONLY vector; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1351 |  | 
|  | 1352 | template <class _Iter1, class _Iter2> | 
|  | 1353 | friend | 
|  | 1354 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1355 | operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1356 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1357 | template <class _Iter1, class _Iter2> | 
|  | 1358 | friend | 
|  | 1359 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1360 | operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1361 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1362 | template <class _Iter1, class _Iter2> | 
|  | 1363 | friend | 
|  | 1364 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1365 | operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1366 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1367 | template <class _Iter1, class _Iter2> | 
|  | 1368 | friend | 
|  | 1369 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1370 | operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1371 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1372 | template <class _Iter1, class _Iter2> | 
|  | 1373 | friend | 
|  | 1374 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1375 | operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1376 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1377 | template <class _Iter1, class _Iter2> | 
|  | 1378 | friend | 
|  | 1379 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1380 | operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1381 |  | 
| Marshall Clow | 3f01389 | 2016-07-18 13:19:00 | [diff] [blame] | 1382 | #ifndef _LIBCPP_CXX03_LANG | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1383 | template <class _Iter1, class _Iter2> | 
|  | 1384 | friend | 
|  | 1385 | auto | 
|  | 1386 | operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
|  | 1387 | -> decltype(__x.base() - __y.base()); | 
|  | 1388 | #else | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1389 | template <class _Iter1, class _Iter2> | 
|  | 1390 | friend | 
|  | 1391 | typename __wrap_iter<_Iter1>::difference_type | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1392 | operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1393 | #endif | 
| Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 | [diff] [blame] | 1394 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1395 | template <class _Iter1> | 
|  | 1396 | friend | 
|  | 1397 | __wrap_iter<_Iter1> | 
| Howard Hinnant | 2baccd8 | 2011-10-11 21:28:38 | [diff] [blame] | 1398 | operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1399 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1400 | template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1401 | template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2); | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1402 | template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1403 | template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); | 
|  | 1404 |  | 
|  | 1405 | template <class _Tp> | 
|  | 1406 | friend | 
|  | 1407 | typename enable_if | 
|  | 1408 | < | 
| Howard Hinnant | 1468b66 | 2010-11-19 22:17:28 | [diff] [blame] | 1409 | is_trivially_copy_assignable<_Tp>::value, | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1410 | _Tp* | 
|  | 1411 | >::type | 
|  | 1412 | __unwrap_iter(__wrap_iter<_Tp*>); | 
|  | 1413 | }; | 
|  | 1414 |  | 
|  | 1415 | template <class _Iter1, class _Iter2> | 
|  | 1416 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1417 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1418 | operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1419 | { | 
|  | 1420 | return __x.base() == __y.base(); | 
|  | 1421 | } | 
|  | 1422 |  | 
|  | 1423 | template <class _Iter1, class _Iter2> | 
|  | 1424 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1425 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1426 | operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1427 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1428 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 8b00e6c | 2013-08-02 00:26:35 | [diff] [blame] | 1429 | _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1430 | "Attempted to compare incomparable iterators"); | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1431 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1432 | return __x.base() < __y.base(); | 
|  | 1433 | } | 
|  | 1434 |  | 
|  | 1435 | template <class _Iter1, class _Iter2> | 
|  | 1436 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1437 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1438 | operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1439 | { | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1440 | return !(__x == __y); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1441 | } | 
|  | 1442 |  | 
|  | 1443 | template <class _Iter1, class _Iter2> | 
|  | 1444 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1445 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1446 | operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1447 | { | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1448 | return __y < __x; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1449 | } | 
|  | 1450 |  | 
|  | 1451 | template <class _Iter1, class _Iter2> | 
|  | 1452 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1453 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1454 | operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1455 | { | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1456 | return !(__x < __y); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1457 | } | 
|  | 1458 |  | 
|  | 1459 | template <class _Iter1, class _Iter2> | 
|  | 1460 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1461 | bool | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1462 | operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1463 | { | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1464 | return !(__y < __x); | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1465 | } | 
|  | 1466 |  | 
| Howard Hinnant | 95c0e9f | 2012-10-02 19:45:42 | [diff] [blame] | 1467 | template <class _Iter1> | 
|  | 1468 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1469 | bool | 
|  | 1470 | operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT | 
|  | 1471 | { | 
|  | 1472 | return !(__x == __y); | 
|  | 1473 | } | 
|  | 1474 |  | 
|  | 1475 | template <class _Iter1> | 
|  | 1476 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1477 | bool | 
|  | 1478 | operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT | 
|  | 1479 | { | 
|  | 1480 | return __y < __x; | 
|  | 1481 | } | 
|  | 1482 |  | 
|  | 1483 | template <class _Iter1> | 
|  | 1484 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1485 | bool | 
|  | 1486 | operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT | 
|  | 1487 | { | 
|  | 1488 | return !(__x < __y); | 
|  | 1489 | } | 
|  | 1490 |  | 
|  | 1491 | template <class _Iter1> | 
|  | 1492 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1493 | bool | 
|  | 1494 | operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT | 
|  | 1495 | { | 
|  | 1496 | return !(__y < __x); | 
|  | 1497 | } | 
|  | 1498 |  | 
| Marshall Clow | 3f01389 | 2016-07-18 13:19:00 | [diff] [blame] | 1499 | #ifndef _LIBCPP_CXX03_LANG | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1500 | template <class _Iter1, class _Iter2> | 
|  | 1501 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1502 | auto | 
|  | 1503 | operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
|  | 1504 | -> decltype(__x.base() - __y.base()) | 
|  | 1505 | { | 
|  | 1506 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
|  | 1507 | _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), | 
|  | 1508 | "Attempted to subtract incompatible iterators"); | 
|  | 1509 | #endif | 
|  | 1510 | return __x.base() - __y.base(); | 
|  | 1511 | } | 
|  | 1512 | #else | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1513 | template <class _Iter1, class _Iter2> | 
|  | 1514 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1515 | typename __wrap_iter<_Iter1>::difference_type | 
| Howard Hinnant | a6119a8 | 2011-05-29 19:57:12 | [diff] [blame] | 1516 | operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1517 | { | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1518 | #if _LIBCPP_DEBUG_LEVEL >= 2 | 
| Howard Hinnant | 8b00e6c | 2013-08-02 00:26:35 | [diff] [blame] | 1519 | _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1520 | "Attempted to subtract incompatible iterators"); | 
| Howard Hinnant | abe2628 | 2011-09-16 17:29:17 | [diff] [blame] | 1521 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1522 | return __x.base() - __y.base(); | 
|  | 1523 | } | 
| Marshall Clow | df4a22d | 2016-07-08 16:54:47 | [diff] [blame] | 1524 | #endif | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1525 |  | 
|  | 1526 | template <class _Iter> | 
|  | 1527 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1528 | __wrap_iter<_Iter> | 
|  | 1529 | operator+(typename __wrap_iter<_Iter>::difference_type __n, | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1530 | __wrap_iter<_Iter> __x) _NOEXCEPT | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1531 | { | 
| Howard Hinnant | 7a563db | 2011-09-14 18:33:51 | [diff] [blame] | 1532 | __x += __n; | 
|  | 1533 | return __x; | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1534 | } | 
|  | 1535 |  | 
| Marshall Clow | df9db31 | 2016-01-13 21:54:34 | [diff] [blame] | 1536 | template <class _Iter> | 
|  | 1537 | struct __libcpp_is_trivial_iterator | 
|  | 1538 | : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; | 
|  | 1539 |  | 
|  | 1540 | template <class _Iter> | 
|  | 1541 | struct __libcpp_is_trivial_iterator<move_iterator<_Iter> > | 
|  | 1542 | : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; | 
|  | 1543 |  | 
|  | 1544 | template <class _Iter> | 
|  | 1545 | struct __libcpp_is_trivial_iterator<reverse_iterator<_Iter> > | 
|  | 1546 | : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; | 
|  | 1547 |  | 
|  | 1548 | template <class _Iter> | 
|  | 1549 | struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> > | 
|  | 1550 | : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; | 
|  | 1551 |  | 
|  | 1552 |  | 
| Marshall Clow | 6daf534 | 2013-12-02 03:24:33 | [diff] [blame] | 1553 | template <class _Tp, size_t _Np> | 
| Marshall Clow | 9dacb2f | 2014-02-19 17:53:30 | [diff] [blame] | 1554 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | 
| Marshall Clow | 6daf534 | 2013-12-02 03:24:33 | [diff] [blame] | 1555 | _Tp* | 
|  | 1556 | begin(_Tp (&__array)[_Np]) | 
|  | 1557 | { | 
|  | 1558 | return __array; | 
|  | 1559 | } | 
|  | 1560 |  | 
|  | 1561 | template <class _Tp, size_t _Np> | 
| Marshall Clow | 9dacb2f | 2014-02-19 17:53:30 | [diff] [blame] | 1562 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | 
| Marshall Clow | 6daf534 | 2013-12-02 03:24:33 | [diff] [blame] | 1563 | _Tp* | 
|  | 1564 | end(_Tp (&__array)[_Np]) | 
|  | 1565 | { | 
|  | 1566 | return __array + _Np; | 
|  | 1567 | } | 
|  | 1568 |  | 
| Marshall Clow | 1c39869 | 2013-12-11 19:32:32 | [diff] [blame] | 1569 | #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) | 
|  | 1570 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1571 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1572 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1573 | auto | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1574 | begin(_Cp& __c) -> decltype(__c.begin()) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1575 | { | 
|  | 1576 | return __c.begin(); | 
|  | 1577 | } | 
|  | 1578 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1579 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1580 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1581 | auto | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1582 | begin(const _Cp& __c) -> decltype(__c.begin()) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1583 | { | 
|  | 1584 | return __c.begin(); | 
|  | 1585 | } | 
|  | 1586 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1587 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1588 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1589 | auto | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1590 | end(_Cp& __c) -> decltype(__c.end()) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1591 | { | 
|  | 1592 | return __c.end(); | 
|  | 1593 | } | 
|  | 1594 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1595 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1596 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1597 | auto | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1598 | end(const _Cp& __c) -> decltype(__c.end()) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1599 | { | 
|  | 1600 | return __c.end(); | 
|  | 1601 | } | 
|  | 1602 |  | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1603 | #if _LIBCPP_STD_VER > 11 | 
|  | 1604 |  | 
| Marshall Clow | 6daf534 | 2013-12-02 03:24:33 | [diff] [blame] | 1605 | template <class _Tp, size_t _Np> | 
|  | 1606 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1607 | reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) | 
|  | 1608 | { | 
|  | 1609 | return reverse_iterator<_Tp*>(__array + _Np); | 
|  | 1610 | } | 
|  | 1611 |  | 
|  | 1612 | template <class _Tp, size_t _Np> | 
|  | 1613 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1614 | reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) | 
|  | 1615 | { | 
|  | 1616 | return reverse_iterator<_Tp*>(__array); | 
|  | 1617 | } | 
|  | 1618 |  | 
|  | 1619 | template <class _Ep> | 
|  | 1620 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1621 | reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) | 
|  | 1622 | { | 
|  | 1623 | return reverse_iterator<const _Ep*>(__il.end()); | 
|  | 1624 | } | 
|  | 1625 |  | 
|  | 1626 | template <class _Ep> | 
|  | 1627 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1628 | reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) | 
|  | 1629 | { | 
|  | 1630 | return reverse_iterator<const _Ep*>(__il.begin()); | 
|  | 1631 | } | 
|  | 1632 |  | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1633 | template <class _Cp> | 
| Marshall Clow | 9dacb2f | 2014-02-19 17:53:30 | [diff] [blame] | 1634 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1635 | auto cbegin(const _Cp& __c) -> decltype(_VSTD::begin(__c)) | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1636 | { | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1637 | return _VSTD::begin(__c); | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1638 | } | 
|  | 1639 |  | 
|  | 1640 | template <class _Cp> | 
| Marshall Clow | 9dacb2f | 2014-02-19 17:53:30 | [diff] [blame] | 1641 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1642 | auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c)) | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1643 | { | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1644 | return _VSTD::end(__c); | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1645 | } | 
|  | 1646 |  | 
|  | 1647 | template <class _Cp> | 
|  | 1648 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1649 | auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) | 
|  | 1650 | { | 
|  | 1651 | return __c.rbegin(); | 
|  | 1652 | } | 
|  | 1653 |  | 
|  | 1654 | template <class _Cp> | 
|  | 1655 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1656 | auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) | 
|  | 1657 | { | 
|  | 1658 | return __c.rbegin(); | 
|  | 1659 | } | 
|  | 1660 |  | 
|  | 1661 | template <class _Cp> | 
|  | 1662 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1663 | auto rend(_Cp& __c) -> decltype(__c.rend()) | 
|  | 1664 | { | 
|  | 1665 | return __c.rend(); | 
|  | 1666 | } | 
|  | 1667 |  | 
|  | 1668 | template <class _Cp> | 
|  | 1669 | inline _LIBCPP_INLINE_VISIBILITY | 
|  | 1670 | auto rend(const _Cp& __c) -> decltype(__c.rend()) | 
|  | 1671 | { | 
|  | 1672 | return __c.rend(); | 
|  | 1673 | } | 
|  | 1674 |  | 
|  | 1675 | template <class _Cp> | 
|  | 1676 | inline _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1677 | auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c)) | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1678 | { | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1679 | return _VSTD::rbegin(__c); | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1680 | } | 
|  | 1681 |  | 
|  | 1682 | template <class _Cp> | 
|  | 1683 | inline _LIBCPP_INLINE_VISIBILITY | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1684 | auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c)) | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1685 | { | 
| Marshall Clow | 02e94f8 | 2016-08-10 20:04:46 | [diff] [blame] | 1686 | return _VSTD::rend(__c); | 
| Marshall Clow | 09da3c0 | 2013-08-30 01:17:07 | [diff] [blame] | 1687 | } | 
|  | 1688 |  | 
|  | 1689 | #endif | 
|  | 1690 |  | 
|  | 1691 |  | 
| Howard Hinnant | 726a76f | 2010-11-16 21:10:23 | [diff] [blame] | 1692 | #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1693 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1694 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1695 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1696 | typename _Cp::iterator | 
|  | 1697 | begin(_Cp& __c) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1698 | { | 
|  | 1699 | return __c.begin(); | 
|  | 1700 | } | 
|  | 1701 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1702 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1703 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1704 | typename _Cp::const_iterator | 
|  | 1705 | begin(const _Cp& __c) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1706 | { | 
|  | 1707 | return __c.begin(); | 
|  | 1708 | } | 
|  | 1709 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1710 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1711 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1712 | typename _Cp::iterator | 
|  | 1713 | end(_Cp& __c) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1714 | { | 
|  | 1715 | return __c.end(); | 
|  | 1716 | } | 
|  | 1717 |  | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1718 | template <class _Cp> | 
| Howard Hinnant | 8289481 | 2010-09-22 16:48:34 | [diff] [blame] | 1719 | inline _LIBCPP_INLINE_VISIBILITY | 
| Howard Hinnant | 9996844 | 2011-11-29 18:15:50 | [diff] [blame] | 1720 | typename _Cp::const_iterator | 
|  | 1721 | end(const _Cp& __c) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1722 | { | 
|  | 1723 | return __c.end(); | 
|  | 1724 | } | 
|  | 1725 |  | 
| Howard Hinnant | 726a76f | 2010-11-16 21:10:23 | [diff] [blame] | 1726 | #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1727 |  | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1728 | #if _LIBCPP_STD_VER > 14 | 
| Marshall Clow | 35e462d | 2015-02-11 16:14:01 | [diff] [blame] | 1729 | template <class _Cont> | 
|  | 1730 | constexpr auto size(const _Cont& __c) -> decltype(__c.size()) { return __c.size(); } | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1731 |  | 
| Marshall Clow | 35e462d | 2015-02-11 16:14:01 | [diff] [blame] | 1732 | template <class _Tp, size_t _Sz> | 
|  | 1733 | constexpr size_t size(const _Tp (&__array)[_Sz]) noexcept { return _Sz; } | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1734 |  | 
| Marshall Clow | 35e462d | 2015-02-11 16:14:01 | [diff] [blame] | 1735 | template <class _Cont> | 
|  | 1736 | constexpr auto empty(const _Cont& __c) -> decltype(__c.empty()) { return __c.empty(); } | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1737 |  | 
| Marshall Clow | 35e462d | 2015-02-11 16:14:01 | [diff] [blame] | 1738 | template <class _Tp, size_t _Sz> | 
|  | 1739 | constexpr bool empty(const _Tp (&__array)[_Sz]) noexcept { return false; } | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1740 |  | 
|  | 1741 | template <class _Ep> | 
|  | 1742 | constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; } | 
|  | 1743 |  | 
| Marshall Clow | 35e462d | 2015-02-11 16:14:01 | [diff] [blame] | 1744 | template <class _Cont> constexpr | 
|  | 1745 | auto data(_Cont& __c) -> decltype(__c.data()) { return __c.data(); } | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1746 |  | 
| Marshall Clow | 35e462d | 2015-02-11 16:14:01 | [diff] [blame] | 1747 | template <class _Cont> constexpr | 
|  | 1748 | auto data(const _Cont& __c) -> decltype(__c.data()) { return __c.data(); } | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1749 |  | 
| Marshall Clow | 35e462d | 2015-02-11 16:14:01 | [diff] [blame] | 1750 | template <class _Tp, size_t _Sz> | 
|  | 1751 | constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; } | 
| Marshall Clow | 03c6791 | 2014-11-19 19:43:23 | [diff] [blame] | 1752 |  | 
|  | 1753 | template <class _Ep> | 
|  | 1754 | constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); } | 
|  | 1755 | #endif | 
|  | 1756 |  | 
|  | 1757 |  | 
| Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 | [diff] [blame] | 1758 | _LIBCPP_END_NAMESPACE_STD | 
|  | 1759 |  | 
|  | 1760 | #endif // _LIBCPP_ITERATOR |